
using System;

namespace DA.AnimGraph.Editor {

    public enum AGEMode : byte {
        Edit,
        Preview,
        Debug,
    }
    
    internal class AGEEnvironment {
        internal readonly ServiceManager serviceManager;
        internal readonly AnimGraphEditorWindow window;
        internal AGEContext ageContext;
        
        public AGEMode ageMode { get; private set; }
        internal event Action OnModeChanged;

        public AGEEnvironment(AnimGraphEditorWindow window) {
            this.window = window;
            ageMode = AGEMode.Edit;
            serviceManager = new ServiceManager();
        }
        public void InitContext(string path) {
            ageContext = new AGEContext(path, this);
        }

        public void OnDisable() {
            ageContext?.OnDisable();
            serviceManager.Clear();
        }
        
        internal void SetMode(AGEMode newMode) {
            if (newMode == ageMode) return;
            ageMode = newMode;
            OnModeChanged?.Invoke();
        }

    }
}
